﻿// /*
//  * @Author: wanyiming
//  * @Date:2024-05-24-22:15
//  * @Description:
//  */

using Code.GameLogic.BaseClass;
using UnityEngine;

namespace Code.GameLogic.Monster.Controller
{
    public class MonsterController:AbsGameLogicController<MonsterBo,MonsterManager>
    {
        public override void InitGo(MonsterBo bo)
        {
            var spriteRenderer = gameObject.AddComponent<SpriteRenderer>();
            spriteRenderer.sprite = Resources.Load<Sprite>("怪物/怪物图/png/"+bo.BaseDescription.TypeName);
            spriteRenderer.sortingOrder = 1;
            // 可选：为图像设置位置、旋转和缩放
            gameObject.transform.rotation = Quaternion.identity; // 设置旋转
            var transform1 = transform;
            transform1.localPosition = new Vector3(0, 0, 0);
            transform1.localScale = new Vector3(0.08f, 0.08f, 1); // 设置缩放


            gameObject.tag = "Monster";

            BoxCollider2D boxCollider2D = gameObject.AddComponent<BoxCollider2D>();
            boxCollider2D.size=new Vector2(3,3);
            boxCollider2D.isTrigger = true;

            Rigidbody2D addComponent = gameObject.AddComponent<Rigidbody2D>();
            addComponent.gravityScale = 0;
        }
    }
}